<template>
  <div class="hyydxq">
    <van-tabs
      color="#37B5B5"
      title-inactive-color="#999999"
      title-active-color="#333333"
      v-model="active"
      @click="onClick"
    >
      <van-tab title="工作安排"><job-placement :key="active1" :houseTypeCode="this.houseTypeCode" /></van-tab>
      <van-tab title="生产计划"><production-plan :key="active2" /></van-tab>
      <van-tab title="操作记录">
        <van-cell style="border-top: 1px #eee solid">
          <div class="flex-between" @click="showPicker1 = true">
            <div class="col-37B5B5 m-r-10">{{ timeChoice || '请选择时间' }}</div>
            <div class="line-text-out text-right rightIcon">
              <img width="8px" src="../../assets/img/bzsc/selectDown.png" />
            </div>
          </div>
        </van-cell>
        <van-popup v-model="showPicker1" position="bottom">
          <van-datetime-picker
            v-model="currentDate"
            type="year-month"
            title="选择年月"
            @confirm="onConfirmStartDate"
            @cancel="showPicker1 = false"
            :formatter="formatter"
          />
        </van-popup>
        <div v-if="contList.length > 0" class="activeContent">
          <div v-for="(item, index) in contList" :key="index" class="productionContent">
            <div class="flex">
              <p class="flex-centers"><i></i></p>
              <p class="col-#333333 font-bold-400">{{ item.date }}</p>
            </div>
            <div :class="[index >= contList.length - 1 ? 'contentBorder' : '']">
              <van-collapse @change="openContent" v-model="activeNames">
                <van-collapse-item v-for="(data, indexs) in item.recordList" :key="indexs" :name="index + ',' + indexs">
                  <template #title>
                    <div>
                      <img
                        width="14px"
                        style="margin-right: 5px"
                        :src="
                          data.name == '饲喂记录'
                            ? require('../../assets/img/x1.png')
                            : data.name == '生长记录'
                            ? require('../../assets/img/x2.png')
                            : data.name == '转舍记录'
                            ? require('../../assets/img/x3.png')
                            : data.name == '离场记录'
                            ? require('../../assets/img/x4.png')
                            : data.name == '疾病诊疗记录'
                            ? require('../../assets/img/x5.png')
                            : data.name == '疫苗接种记录'
                            ? require('../../assets/img/x6.png')
                            : data.name == '配种记录'
                            ? require('../../assets/img/x7.png')
                            : data.name == '采精记录'
                            ? require('../../assets/img/x8.png')
                            : data.name == '受孕确认记录'
                            ? require('../../assets/img/x9.png')
                            : data.name == '病死无害化处理记录'
                            ? require('../../assets/img/x10.png')
                            : data.name == '产羔记录'
                            ? require('../../assets/img/x11.png')
                            : data.name == '其他记录'
                            ? require('../../assets/img/x12.png')
                            : ''
                        "
                      />{{ data.name }}
                    </div>
                  </template>
                  <!-- <template #right-icon>
                  <div><img width="8px" style="margin-right: 5px" src="../../assets/img/bzsc/selectDown.png" /></div>
                </template> -->
                  <div v-if="data.name == '饲喂记录'">
                    <van-cell
                      v-for="(content, key) in feedingList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-bold-500 font-15 m-r-10">{{ content.forageName || '' }}</div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.useStartDate | dateFormat('YYYY-MM-DD') }} ~
                          {{ content.useEndDate | dateFormat('YYYY-MM-DD') }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">用量：{{ content.dosage || '' }}kg</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">创建人：{{ content.createdByName || '' }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime || '' }}</div>
                      </div>
                    </van-cell>
                  </div>
                  <div v-if="data.name == '产羔记录'">
                    <van-cell
                      v-for="(content, key) in LambingList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-bold-500 font-15 m-r-10">
                          {{ (!!content.individualInfo && content.individualInfo.earLabelNo) || '' }}
                        </div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.lambDate | dateFormat('YYYY-MM-DD') }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">
                          产羔数量：公：{{ content.maleLambNum }} /母：{{ content.femaleLambNum }}/弱羔数：{{
                            content.weakLambNum
                          }}
                          /死胎数：{{ content.stillbirthNum }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">
                          健壮羔羊数量：公：{{ content.robustMaleLambNum }}/母：{{ content.robustFemaleLambNum }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建人：{{ content.createdByName || '' }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime || '' }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '受孕确认记录'">
                    <van-cell
                      v-for="(content, key) in conceptionList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-15 m-r-10">{{ content.verifyDate | dateFormat('YYYY-MM-DD') }}</div>
                        <div class="col-999999 line-text-out text-right"></div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10" style="width: 100%">
                          受孕成功数量（只）：{{ content.pregnancySuccessNum || '' }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createdByName || '' }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime || '' }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '生长记录'">
                    <van-cell
                      v-for="(content, key) in GrowingList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-15 m-r-10">耳标号: {{ content.earLabelNo }}</div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.recordDate && content.recordDate.substring(0, 10) }}
                        </div>
                      </div>
                      <!-- <div class="flex-between font-13 line-height-3">
            <div class="col-666666 m-r-10 line-text-out">疫苗名称：疫苗名称疫苗名称疫苗名称疫苗名</div>
          </div> -->
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">体重（kg）：{{ content.weight }}</div>
                        <div class="col-666666 m-r-10">体高（cm）：{{ content.height }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createdByName }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>
                  <div v-if="data.name == '其他记录'">
                    <van-cell
                      v-for="(content, key) in otherList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between line-height-3">
                        <div class="col-333333 font-bold-500 font-15 m-r-10">{{ content.operation || '' }}</div>
                      </div>
                      <div class="flex-between font-13">
                        <div class="col-666666 m-r-10 multi-text-overrun" style="line-height: 18px">
                          {{ content.content || '' }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-999999 line-text-out text-right">
                          创建人： {{ content.createdByName || '' }}
                        </div>
                        <div class="col-999999 m-r-10 line-text-out">创建时间：{{ content.createTime || '' }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '转舍记录'">
                    <van-cell
                      v-for="(content, key) in InTheList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-999999 line-text-out text-right">
                          {{ content.changeCircleDate && content.changeCircleDate.substring(0, 10) }}
                        </div>
                      </div>
                      <!-- <div class="flex-between font-13 line-height-3">
            <div class="col-666666 m-r-10 line-text-out">疫苗名称：疫苗名称疫苗名称疫苗名称疫苗名</div>
          </div> -->
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">{{ '转入羊舍: ' + content.changeToHouseName }}</div>
                      </div>

                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">羊数量 (只)：{{ content.changeCricleCount }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          创建人：{{ content && content.createdByName }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '离场记录'">
                    <van-cell
                      v-for="(content, key) in offTheList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-999999 line-text-out text-right">
                          {{ content.departureDate && content.departureDate.substring(0, 10) }}
                        </div>
                      </div>
                      <!-- <div class="flex-between font-13 line-height-3">
            <div class="col-666666 m-r-10 line-text-out">疫苗名称：疫苗名称疫苗名称疫苗名称疫苗名</div>
          </div> -->
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">离场原因: {{ content.departureReason.name }}</div>
                      </div>

                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">羊数量 (只)：{{ content.departureNum }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createByName }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '疾病诊疗记录'">
                    <van-cell
                      v-for="(content, key) in diseasesList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-bold-500 line-text-out font-15 m-r-10">
                          耳标号：{{ content.earLabelNo }}
                        </div>
                        <div class="col-999999 line-text-out text-right">{{ content.treatDate }}</div>
                      </div>
                      <!-- <div class="flex-between font-13 line-height-3">
            <div class="col-666666 m-r-10 line-text-out">疫苗名称：疫苗名称疫苗名称疫苗名称疫苗名</div>
          </div> -->
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          疫病类型： <span>{{ content.diseaseTypeCode ? content.diseaseTypeCode.name : '' }}</span>
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          疫病名称： <span>{{ content.diseaseName }}</span>
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          使用药品： <span>{{ content.drugUseName }}</span>
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          创建人： <span>{{ content.createdByName }}</span>
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          创建时间： <span>{{ content.createTime }}</span>
                        </div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '疫苗接种记录'">
                    <van-cell
                      v-for="(content, key) in vaccineList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-bold-500 font-15 m-r-10">{{ content.inoculateBatch }}</div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.inoculateDate.substring(0, 10) }}
                        </div>
                      </div>
                      <!-- <div class="flex-between font-13 line-height-3">
            <div class="col-666666 m-r-10 line-text-out">疫苗名称：疫苗名称疫苗名称疫苗名称疫苗名</div>
          </div> -->
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">疫苗名称 ：{{ content.vaccinName }}</div>
                        <div class="col-666666 m-r-10">羊数量（只）：{{ content.vaccinationRecordNum }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createdByName }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '配种记录'">
                    <van-cell
                      v-for="(content, key) in breedingList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-bold-500 font-15 m-r-10">
                          耳标号: {{ content.motherEarLabelNo }}
                        </div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.breedDate && content.breedDate.substring(0, 10) }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">
                          配种方式：{{ content && content.breedType && content.breedType.name }}
                        </div>
                      </div>

                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">配种公羊耳标号：{{ content.fatherEarLabelNo }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createdByName }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>

                  <div v-if="data.name == '病死无害化处理记录'">
                    <van-cell
                      v-for="(content, key) in harmlessList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-999999 line-text-out text-right">
                          {{ content.recordDate && content.recordDate.substring(0, 10) }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">处理或死亡原因：{{ content.dieType.name }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">{{ '处理方式: ' + content.handleMethod.name }}</div>
                      </div>

                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10">羊数量 (只)：{{ content.handleCount }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">创建人：{{ content.createByName }}</div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 m-r-10 line-text-out">创建时间：{{ content.createTime }}</div>
                      </div>
                    </van-cell>
                  </div>
                  <div v-if="data.name == '采精记录'">
                    <van-cell
                      v-for="(content, key) in semenList"
                      v-if="content.createTime.indexOf(item.date) != -1"
                      :key="key"
                      @click="operationDetails(content.id, data.name)"
                      class="content"
                    >
                      <div class="flex-between font-14 line-height-3">
                        <div class="col-333333 font-15 m-r-10">耳标号：{{ content.individualInfo.earLabelNo }}</div>
                        <div class="col-999999 line-text-out text-right">
                          {{ content.createTime | dateFormat('YYYY-MM-DD') }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          采精量（ml）：
                          {{ content.semenMilliliters }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          创建人：
                          {{ content.createdByName }}
                        </div>
                      </div>
                      <div class="flex-between font-13 line-height-3">
                        <div class="col-666666 line-text-out text-right">
                          创建时间：
                          {{ content.createTime }}
                        </div>
                      </div>
                    </van-cell>
                  </div>
                </van-collapse-item>
              </van-collapse>
            </div>
          </div>
        </div>
        <temporarily-data v-else />
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
// 保养记录
import { getValue, setValue } from '@/utils/auth'
import { Toast, Cell, Tab, Tabs, Collapse, CollapseItem, Popup, DatetimePicker } from 'vant'
import { getHandle, postHandle } from '@/api'
import JobPlacement from '@/components/jobPlacement'
import ProductionPlan from '@/components/productionPlan'
import TemporarilyData from '@/components/temporarilyData'
import dayjs from 'dayjs'
export default {
  components: {
    JobPlacement,
    ProductionPlan,
    TemporarilyData,
    [Cell.name]: Cell,
    [Tab.name]: Tab,
    [Tabs.name]: Tabs,
    [Toast.name]: Toast,
    [Collapse.name]: Collapse,
    [CollapseItem.name]: CollapseItem,
    [Popup.name]: Popup,
    [DatetimePicker.name]: DatetimePicker
  },
  data() {
    return {
      timeChoice: '',
      timeChoice1: '',
      showPicker1: false,
      currentDate: new Date(),
      activeNames: [],
      activeYm: [],
      active: 0,
      refreshing: false,
      list: [],
      loading: false,
      finished: false,
      houseInfoId: getValue('fzmHourseId') || '',
      contList: [],
      houseTypeCode: getValue('houseTypeCode'),
      params: {
        page: 1,
        perPage: 10
      },
      active1: 1,
      active2: 1,
      feedingList: [],
      LambingList: [],
      conceptionList: [],
      GrowingList: [],
      InTheList: [],
      offTheList: [],
      diseasesList: [],
      vaccineList: [],
      breedingList: [],
      harmlessList: [],
      semenList: [],
      otherList: []
    }
  },
  watch: {},
  created() {},
  mounted() {
    this.$bridge.register('refresh', data => {
      // 请加上自己的事件列表事件
      this.active1++
      this.active2++
      this.feedingList = []
      this.LambingList = []
      this.conceptionList = []
      this.GrowingList = []
      this.InTheList = []
      this.offTheList = []
      this.diseasesList = []
      this.vaccineList = []
      this.breedingList = []
      this.harmlessList = []
      this.semenList = []
      this.activeNames = []
      this.otherList = []
      if (this.active == 2) {
        this.operationRecords()
      }
    })
    this.timeChoice = dayjs(this.currentDate).format('YYYY年MM月')
    this.timeChoice1 = dayjs(this.currentDate).format('YYYY-MM')
  },
  methods: {
    operationDetails(id, name) {
      if (name == '产羔记录') {
        setValue('cgId', id)
        this.$bridge.call('lambingRecordDetails')
      } else if (name == '采精记录') {
        setValue('ejaculationsRecordId', id)
        this.$bridge.call('viewEjaculationsRecord')
      } else if (name == '饲喂记录') {
        setValue('swId', id)
        this.$bridge.call('feedingRecordDetails')
      } else if (name == '受孕确认记录') {
        setValue('syId', id)
        this.$bridge.call('detailsPregnancyRecord')
      } else if (name == '生长记录') {
        setValue('grow-view-id', id)
        this.$bridge.call('viewGrowthRecord')
      } else if (name == '转舍记录') {
        setValue('changeCircle-view-id', id)
        this.$bridge.call('viewChangeCircle')
      } else if (name == '离场记录') {
        setValue('leave-view-id', id)
        this.$bridge.call('viewLeaveRecord')
      } else if (name == '疾病诊疗记录') {
        setValue('diseaseRecordId', id)
        this.$bridge.call('viewDiseaseRecord')
      } else if (name == '疫苗接种记录') {
        setValue('vacc-view-id', id)
        this.$bridge.call('viewVaccinesRecord')
      } else if (name == '配种记录') {
        setValue('breed-view-id', id)
        this.$bridge.call('viewBreedingRecord')
      } else if (name == '病死无害化处理记录') {
        setValue('dead-view-id', id)
        this.$bridge.call('viewDeadRecord')
      } else if (name == '其他记录') {
        setValue('otherId', id)
        this.$bridge.call('otherRecordsDetails')
      }
    },
    openContent(e) {
      e.forEach(item => {
        this.differentTypes(item)
      })
    },
    differentTypes(item) {
      const List = item.split(',')
      const index1 = List[0]
      const index2 = List[1]
      const colListName = this.contList[index1].recordList[index2].name
      const data = {
        page: 1,
        perPage: 1000,
        houseInfoId: this.houseInfoId,

        dateRange: this.timeChoice1 + '-01' + ',' + this.timeChoice1 + '-30'
      }
      if (this.feedingList.length == 0 && colListName == '饲喂记录') {
        getHandle('/agri/api/yzbzh/feedingRecord/queryListPage', data).then(res => {
          this.feedingList = res.data.rows
        })
      }
      if (this.LambingList.length == 0 && colListName == '产羔记录') {
        getHandle('/agri/api/yzbzh/lambingRecord/queryListPage', data).then(res => {
          this.LambingList = res.data.rows
        })
      }
      if (this.conceptionList.length == 0 && colListName == '受孕确认记录') {
        getHandle('/agri/api/yzbzh/pregnancyRecord/queryListPage', data).then(res => {
          this.conceptionList = res.data.rows
        })
      }
      if (this.GrowingList.length == 0 && colListName == '生长记录') {
        getHandle('/agri/api/yzbzh/growRecord/queryListPage', data).then(res => {
          this.GrowingList = res.data.rows
        })
      }
      if (this.InTheList.length == 0 && colListName == '转舍记录') {
        getHandle('/agri/api/yzbzh/changeCircleRecord/queryListPage', data).then(res => {
          this.InTheList = res.data.rows
        })
      }
      if (this.offTheList.length == 0 && colListName == '离场记录') {
        getHandle('/agri/api/yzbzh/departureRecord/queryListPage', data).then(res => {
          this.offTheList = res.data.rows
        })
      }
      if (this.diseasesList.length == 0 && colListName == '疾病诊疗记录') {
        getHandle('/agri/api/yzbzh/diseaseTreatRecord/queryListPage', data).then(res => {
          this.diseasesList = res.data.rows
        })
      }
      if (this.vaccineList.length == 0 && colListName == '疫苗接种记录') {
        getHandle('/agri/api/yzbzh/vaccinationRecord/queryListPage', data).then(res => {
          this.vaccineList = res.data.rows
        })
      }
      if (this.breedingList.length == 0 && colListName == '配种记录') {
        getHandle('/agri/api/yzbzh/breedRecord/queryListPage', data).then(res => {
          this.breedingList = res.data.rows
        })
      }
      if (this.harmlessList.length == 0 && colListName == '病死无害化处理记录') {
        getHandle('/agri/api/yzbzh/dieHarmlesshandle/queryListPage', data).then(res => {
          this.harmlessList = res.data.rows
        })
      }
      if (this.semenList.length == 0 && colListName == '采精记录') {
        getHandle('/agri/api/yzbzh/semenRecord/queryListPage', data).then(res => {
          this.semenList = res.data.rows
        })
      }
      if (this.otherList.length == 0 && colListName == '其他记录') {
        getHandle('/agri/api/yzbzh/otherRecord/queryListPage', data).then(res => {
          this.otherList = res.data.rows
        })
      }
    },
    onConfirmStartDate(value) {
      this.timeChoice1 = dayjs(value).format('YYYY-MM')
      this.timeChoice = dayjs(value).format('YYYY年MM月')
      this.activeNames = []
      this.feedingList = []
      this.LambingList = []
      this.conceptionList = []
      this.GrowingList = []
      this.InTheList = []
      this.offTheList = []
      this.diseasesList = []
      this.vaccineList = []
      this.breedingList = []
      this.harmlessList = []
      this.semenList = []
      this.operationRecords()
      this.showPicker1 = false
    },
    formatter(type, val) {
      if (type === 'year') {
        return `${val}`
      } else if (type === 'month') {
        return `${val}`
      }
      return val
    },
    onClick(e) {
      if (e == 2) {
        this.operationRecords()
      } else if (e == 1) {
        // this.productionPlan()
        // this.active2++
      } else if (e == 0) {
        // this.active1++
      }
    },

    operationRecords() {
      const params = {
        // subjectInfoId: getValue('subjectInfoId'),
        // tenantCode: getValue('tenantCode'),
        houseInfoId: this.houseInfoId,
        recordDate: this.timeChoice1
      }
      postHandle('/agri/api/yzbzh/houseOperation/findGroupList', params).then(res => {
        if (res.status == 0) {
          this.contList = res.data.rows
        }
      })
    },
    // 卡片列表
    onRefresh() {
      this.params.page = 1
      this.finished = false

      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      this.loading = true
      this.onLoad()
    },
    onSearch() {
      this.params.page = 1
      this.list = []
      this.finished = false

      // 重新加载数据
      // 将 loading 设置为 true，表示处于加载状态
      this.loading = true
      this.onLoad()
    },
    onLoad() {
      setTimeout(() => {
        this.refreshing = false
        this.loading = false
        this.list = this.list.concat([, , ,])
        this.finished = true
      }, 1000)
    }
  }
}
</script>

<style lang="scss" scoped>
.rightIcon {
  margin-top: -1px;
}
.topCeiling {
  position: fixed;
  top: 0;
  z-index: 1;
}
.topDate {
  width: 80%;
  margin: auto;
  display: flex;
  justify-content: space-between;
  > p {
    font-size: 15px;
    &:first-child {
      width: 40%;
    }
    &:last-child {
      width: 40%;
    }
  }
}
.van-field__control {
  border: 0 !important;
}

.productionContent {
  padding: 0 16px 5px;
  font-size: 15px;
  > div {
    &:first-child {
      > p {
        &:last-child {
          position: relative;
          margin-top: -1px;
        }
        &:first-child {
          position: relative;
          width: 14px;
          height: 14px;
          border-radius: 7px;
          background-color: #bde2e2;
          margin-right: 15px;
          > i {
            display: block;
            width: 6px;
            height: 6px;
            background-color: #37b5b5;
            border-radius: 3px;
          }
        }
      }
    }
    &:last-child {
      padding: 15px 0 8px 15px;
      border-left: 1px dashed #37b5b5;
      margin-left: 6px;
    }
  }
}
::v-deep .van-cell__right-icon {
  color: #37b5b5;
}
::v-deep .van-collapse-item__wrapper {
  background-color: transparent;
}
.activeContent {
  padding-top: 15px !important ;
}
::v-deep .van-collapse-item {
  margin-bottom: 12px;
  border-radius: 6px !important;
  background-color: #fff;
  &:last-child {
    margin-bottom: 0;
  }
}
::v-deep .van-cell--clickable {
  background-color: transparent;
}
.content {
  background-color: #fafafa;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}
::v-deep .van-collapse-item__content {
  background-color: transparent;
  padding: 12px 16px 3px;
}
.contentBorder {
  border: none !important;
}
::v-deep .van-picker__title {
  line-height: inherit;
}
</style>
